#include <fstream>
#include <vector>
#include <string.h>
#include<stdlib.h>

using namespace std;

#define FIXED_LENGTH_MESSAGE   1024*60

class FileReadUtil
{
public:
	FileReadUtil(void);
	~FileReadUtil(void);
    static FileReadUtil* getInstance()
    {
        if(m_instance == NULL)
        {
            m_instance = new FileReadUtil;
        }
        return m_instance;
    }
    static void delInstance()
    {
        if (m_instance)
        {
            delete m_instance;
            m_instance = NULL;
        }
    }
	bool OpenFile(std::string fileName);
	void CloseFile();
	std::string GetLine();
	//按照块读取文件
	int GetMultitudeLineData();
    char* GetBlockData(int * iLen);
	//判断文件是否到末尾
	bool GetFileEof();
    double GetFileLength();
    //strFileName 文件的全路径
    int GetFileOffset(std::string strFileName);

	bool m_DataGetFinist;
private:
	vector<std::string> m_FileContentTemp;
	int m_iTotalRow;
	int m_CurrentRow;
	int m_FileSeek;
	
    static FileReadUtil* m_instance;
	fstream *mStream;
	std::string strCurrentFile;
	bool   m_FileReadEof;
	//读取一块数据
	int GetBlockData(char *Buffer,int iLen);

};
